import { _decorator, Component, director, Mask, Node, tween, v2, v3, Vec3 } from 'cc';
import { ImgBooks } from './home/ImgBooks';
import { IslandItem } from './home/IslandItem';
import { IslandPage } from './home/IslandPage';
const { ccclass, property } = _decorator;

@ccclass('homeMgr')
export class homeMgr extends Component {

    @property(ImgBooks)
    imgBooks:ImgBooks = null;

    @property(IslandPage)
    island:IslandPage = null;


    @property(Node)
    select_pop_plane:Node = null

    s_pop = false;
    /** 弹出选项 */
    onSelectPop(){
        let init_scale = v3(1,0,1)
        let tar_scale = v3(1,1,1)
        if(!this.s_pop){
            this.s_pop = true;
        }
        else{
            init_scale = v3(1,1,1)
            tar_scale = v3(1,0,1)
            this.s_pop = false;
        }

        this.select_pop_plane.scale = init_scale
        tween(this.select_pop_plane).to(0.25 , {scale:tar_scale}).start()
    }

    start() {
        
    }

    onSignInBtn(){
        console.log('签到')
    }
    
    onRankingBtn(){
        console.log('排行')
        
    }
    
    onTaskBtn(){
        console.log('任务')
        
    }
    
    onImgBookBtn(){
        console.log('图鉴')
        this.imgBooks.on_open();
    }

    /** 打开岛屿 */
    onOpenIsland(){
        this.island.onOpen()
    }

    onStartGame(){
        console.log('开始游戏')

        director.loadScene('game')
    }
}


